﻿using System.Collections.Generic;
using System.Linq;
using LBoL.Base;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Battle.Interactions;
using LBoL.Core.Cards;
using LBoL.Core.StatusEffects;
using LBoL.EntityLib.StatusEffects.Neutral.Blue;
using LBoLEntitySideloader.Attributes;
using ProbeMod.Cards.Template;
using ProbeMod.StatusEffects;

namespace ProbeMod.Cards
{
    public sealed class ProbeWengDef : ProbeCardTemplate
    {
        public override CardConfig MakeConfig()
        {
            CardConfig config = GetCardDefaultConfig();

            config.Rarity = Rarity.Uncommon;
            config.Type = CardType.Ability;
            config.TargetType = TargetType.Nobody;

            config.Colors = new List<ManaColor>() { ManaColor.Blue };
            config.Cost = new ManaGroup() { Blue = 1, Any = 1 };
            config.Cost = new ManaGroup() { Blue = 1, Any = 1 };


            config.Index = CardIndexGenerator.GetUniqueIndex(config);
            return config;
        }
    }

    /// <summary>
    /// 稳
    /// </summary>
    [EntityLogic(typeof(ProbeWengDef))]
    public sealed class ProbeWeng : ProbeCard
    {
        public int Heal => IsUpgraded ? 15 : 10;

        public int Exchange => IsUpgraded ? 5 : 3;

        protected override IEnumerable<BattleAction> Actions(UnitSelector selector, ManaGroup consumingMana, Interaction precondition)
        {
            if (IsUpgraded)
            {
                yield return BuffAction<MoreDraw>(level: 1);
            }
            yield return BuffAction<ProbeWengSe>(level: Exchange);
            yield return BuffAction<ProbeEndBattleHealSe>(level: Heal);
        }
    }
}
